import urllib.request
from urllib.request import urlopen

if __name__ == "__main__":
    myURL = urlopen("https://www.w3cschool.cn/")
    # print(myURL.read())
    print(myURL.getcode())

    try:
        myURL2 = urllib.request.urlopen("https://www.w3cschool.cn/no.html")
    except urllib.error.HTTPError as e:
        if e.code == 404:
            print(404)